/********************************************************************
* @Copyright: Metanergy Technology R&D Co., Ltd
* @Filename: myg0025_pwr.h
* @brief  :
* @Author : AE Team
********************************************************************/

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MYG0025_PWR_H
#define __MYG0025_PWR_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "myg0025.h"

/** @addtogroup PWR  PWR
  * @{
  */
/** @defgroup Regulator_state_is_STOP_mode Regulator_state_is_STOP_mode
  * @{
  */

#define PWR_Regulator_ON          ((uint32_t)0x00000000)
#define PWR_Regulator_LowPower    ((uint32_t)0x00000001)
#define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_LowPower)||((REGULATOR)==PWR_Regulator_ON))

/**
  * @}
  */

/** @defgroup PWR_STOP_mode_entry PWR_STOP_mode_entry
  * @{
  */

#define PWR_STOPEntry_WFI               ((uint8_t)0x01)
#define PWR_STOPEntry_WFE               ((uint8_t)0x02)
#define PWR_STOPEntry_SLEEPONEXIT       ((uint8_t)0x03)
#define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE) ||\
                                  ((ENTRY) == PWR_STOPEntry_SLEEPONEXIT))


#define PWR_SLEEPEntry_WFI              ((uint8_t)0x01)
#define PWR_SLEEPEntry_WFE              ((uint8_t)0x02)
#define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPEntry_WFI) || ((ENTRY) == PWR_SLEEPEntry_WFE))


/**
  * @}
  */

/** @defgroup PWR_mode_entry PWR_mode_entry
  * @{
  */

#define PWR_Entry_WFI              ((uint8_t)0x01)
#define PWR_Entry_WFE              ((uint8_t)0x02)
#define PWR_Entry_SLEEPONEXIT      ((uint8_t)0x03)
#define IS_PWR_ENTRY(ENTRY) (((ENTRY) == PWR_Entry_WFI) || ((ENTRY) == PWR_Entry_WFE) ||\
                                   ((ENTRY) == PWR_Entry_SLEEPONEXIT))


/**
  * @}
  */


/** @defgroup PWR_Flag  PWR_Flag
  * @{
  */



#define PWR_FLAG_LDORDY           ((uint32_t)0x00000008)
#define IS_PWR_GET_FLAG(FLAG) ((FLAG) == PWR_FLAG_LDORDY)

/**
  * @}
  */

/**
  * @}
  */




/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */

/* Function used to set the PWR configuration to the default reset state ******/
void PWR_DeInit(void);

/* Low Power modes configuration functions ************************************/

void PWR_EnterStopMode(uint32_t PWR_Regulator, uint8_t PWR_Entry);
void PWR_EnterSleepMode(uint8_t PWR_SLEEPEntry);

/* Flags management functions *************************************************/
FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);

#ifdef __cplusplus
}
#endif

#endif /* __MYG0025_PWR_H */


